package com.atguigu.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author machuan
 * @create 2021-08-10 8:43 上午
 **/
//@Configuration
public class MyGateWayConfig {
//    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder route= routeLocatorBuilder.routes();
        route.route("path_route_atguigu_guonei",r->
            r.path("/guonei").uri("http://news.baidu.com/guonei")
        ).build();
        return route.build();
    }

    //    @Bean
    public RouteLocator routeLocatorguoji(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder route= routeLocatorBuilder.routes();
        route.route("path_route_atguigu_guoji",r->
                r.path("/guonji").uri("http://news.baidu.com/guonji")
        ).build();
        return route.build();
    }



}
